<?php
/**
* @package RecruitmentManagerAdmin
* @version 1.5.0 RC1, April 2009
*/

// Sample Data Script

defined( '_JEXEC' ) or die( 'Direct Access to this location is not allowed.' ); 

function install_sample_data($sqlfilename) {

//get the database configuration settings
$conf =& JFactory::getConfig();
$dbhost = $conf->getValue('config.host');
$dbuser = $conf->getValue('config.user');
$dbpassword = $conf->getValue('config.password');
$dbname = $conf->getValue('config.db');
$dbprefix = $conf->getValue('config.dbprefix');

// connect to the database
mysql_connect($dbhost,$dbuser,$dbpassword) or die("mysql_connect fail");
mysql_select_db($dbname) or die("mysql_select_db fail");

// Insert the requested sample data
$query = "INSERT INTO `".$dbprefix.file_get_contents(dirname(__FILE__).DS.$sqlfilename);
//echo "<p>SQL = $query</p>\n"; // debugging only
$answer = mysql_query($query);
// check for any error
if (mysql_error()) {
	echo "<p><b>Error inserting sample data:-</b> </p>\n" . mysql_error();
} else {
	echo "<p>Sample data inserted OK.</p>\n";
}

} // eof function

?>